{extend name="common:main" /}
{block name="cssjs"}
<script src="__PUBLIC__/static/js/admin/proxy.js?{$Think.config.html_v}"></script>
{/block}
{block name="content"}
<div class="nav-tabs-custom">
	{include file="setting/caiji_nav" /}
	<div class="tab-content">
		<div class="tab-pane active" style="padding:0px 5px;">
		<form id="form_set" method="post" ajax-submit="true" role="form" action="{:url('Admin/Setting/Translate')}">
      		<div class="form-group">
		        <label>开启翻译</label>
		        <div class="input-group">
		        	<label class="radio-inline"><input type="radio" name="open" value="1">{$Think.lang.yes}</label>
		        	<label class="radio-inline"><input type="radio" name="open" value="0">{$Think.lang.no}</label>
		        </div>
		        <p class="help-block">开启后采集器中的翻译功能才会生效</p>
		    </div>
		    <div id="translate_open" style="display:none;">
				<div class="form-group">
			    	<label>翻译API接口</label>
			        <select name="api" class="form-control">
			        	<option value="">--请选择--</option>
			        	<option value="baidu">百度翻译</option>
			        	<option value="youdao">有道翻译</option>
			        	<option value="qq">腾讯翻译</option>
			        </select>
		    	</div>
			    <div class="form-group" id="api_baidu" style="display:none;">
			        <label>百度翻译API &nbsp;<a href="https://www.baidu.com/s?wd=%E7%99%BE%E5%BA%A6%E7%BF%BB%E8%AF%91api" class="small" target="_blank">申请</a></label>
			        <div class="input-group">
			        	<span class="input-group-addon">APPID</span>
			        	<input type="text" name="baidu[appid]" class="form-control" value="{$transConfig['baidu']['appid']}">
			        	<span class="input-group-addon" style="border-left:0;border-right:0;">密钥</span>
				       	<input type="text" name="baidu[key]" class="form-control" value="{$transConfig['baidu']['key']}">
				    </div>
				    <p class="help-block">支持语种：{$apiLangs['baidu']}</p>
			    </div>
			    <div class="form-group" id="api_youdao" style="display:none;">
			        <label>有道翻译API &nbsp;<a href="https://www.baidu.com/s?wd=%E6%9C%89%E9%81%93%E7%BF%BB%E8%AF%91api" class="small" target="_blank">申请</a></label>
			        <div class="input-group">
			        	<span class="input-group-addon">应用ID</span>
			        	<input type="text" name="youdao[appkey]" class="form-control" value="{$transConfig['youdao']['appkey']}">
			        	<span class="input-group-addon" style="border-left:0;border-right:0;">应用密钥</span>
				       	<input type="text" name="youdao[key]" class="form-control" value="{$transConfig['youdao']['key']}">
				    </div>
				    <p class="help-block">支持语种：{$apiLangs['youdao']}</p>
			    </div>
			    <div class="form-group" id="api_qq" style="display:none;">
			        <label>腾讯翻译API &nbsp;<a href="https://www.baidu.com/s?wd=%E8%85%BE%E8%AE%AF%E7%BF%BB%E8%AF%91api" class="small" target="_blank">申请</a></label>
			        <div class="input-group">
			        	<span class="input-group-addon">SecretId</span>
			        	<input type="text" name="qq[secretid]" class="form-control" value="{$transConfig['qq']['secretid']}">
			        	<span class="input-group-addon" style="border-left:0;border-right:0;">SecretKey</span>
				       	<input type="text" name="qq[secretkey]" class="form-control" value="{$transConfig['qq']['secretkey']}">
				    </div>
				    <p class="help-block">支持语种：{$apiLangs['qq']}</p>
			    </div>
			</div>
		   	<div class="form-group">
				<button type="submit" id="btn_sub" class="btn btn-primary btn-block">{$Think.lang.save}</button>
			</div>
		</form>
		</div>
	</div>
</div>
<script type="text/javascript">
'use strict';//严格模式
$('#form_set [name="open"]').bind('click',function(){
	if($(this).val()==1){
		$('#translate_open').show();
	}else{
		$('#translate_open').hide();
	}
});

$('#form_set [name="api"]').bind('change',function(){
	$('[id^="api_"]').hide();
	$('#api_'+$(this).val()).show();
});
{if condition="!empty($transConfig)"}
$('#form_set [name="open"][value="{$transConfig["open"]|intval}"]').trigger('click');
$('#form_set [name="api"]').val("{$transConfig['api']}").trigger("change");
{/if}
</script>
{/block}